package com.example.provider;

import org.apache.ibatis.jdbc.SQL;

public class PrivilegeProvider {

    public String selectById(final Long id){
        return new SQL(){
            // 通过初始化块来构建SQL
            {
                SELECT("id, privilege_name as privilegeName, privilege_url as privilegeUrl");
                FROM("sys_privilege");
                WHERE("id=#{id}");
            }
        }.toString();
    }

    public String selectById2(final Long id){
        return "select id, privilege_name as privilegeName, privilege_url as privilegeUrl "
                + " from sys_privilege "
                + " where id=#{id}";
    }
}
